define(['app'],function(app){return {module: function($scope, $http, eventBusService, httpService, params) {
	
	$scope.form.ids = params.ids;
	$scope.t = params.t;

	$scope.saveForm = function() {
		// if ($scope.formCheck()) {
		let handlerType = $scope.form.type;
		let manager_type = $scope.form.manager_type;
		if ($scope.t == '1'){
			if (typeof(handlerType) === "undefined" || handlerType === null || handlerType === "") {
				eventBusService.publish('modal.alert', {"title":"操作提示","content":"请选择部门负责人。"});
				return
			}
		}
		if ($scope.t == '2'){
			if (typeof(manager_type) === "undefined" || manager_type === null || manager_type === "") {
				eventBusService.publish('modal.alert', {"title":"操作提示","content":"请选择部门管理。"});
				return
			}
		}

		httpService.post(app.urls.organization_updateDeptHandlerType, $scope.form, function (data) {
			if ("0000" === data.code) {
				eventBusService.publish("content.page.reload", data);
				eventBusService.publish("modal.page.close", {});
			}else {
				alert(data.msg);
			}
		});
	}
}}});